package com.mlong.admin.modular.unicomjs.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kordar.admin.kernel.wrapper.QueryWrapperEntity;
import com.mlong.admin.modular.unicomjs.entity.Order;
import com.mlong.admin.modular.unicomjs.mapper.OrderMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@AllArgsConstructor
@DS("#kordardb")
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
    
    private final OrderMapper orderMapper;
    
    @Override
    public IPage<Order> iPage(QueryWrapperEntity<Order> entity) {
        Page<Order> page = entity.where(Order.class).orderBy().queryPage();
        QueryWrapper<Order> query = entity.getQuery();
        return orderMapper.selectPage(page, query);
    }

    @Override
    public IPage<Order> excelData(QueryWrapperEntity<Order> entity, Integer maxPagesize) {
        Page<Order> page = entity.where(Order.class).orderBy().queryPage(maxPagesize);
        QueryWrapper<Order> query = entity.getQuery();
        return orderMapper.selectPage(page, query);
    }
}
